package cn.weiron.fun.sample.controller;


import cn.weiron.fun.infrastructure.auth.Authority;
import cn.weiron.fun.sample.entity.SampleAudit;
import cn.weiron.fun.sample.service.SampleAuditService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * (SampleAudit)表控制层
 *
 * @author makejava
 * @since 2022-07-17 17:46:35
 */
@RestController
@RequestMapping("/sampleAudit")
public class SampleAuditController {


    public SampleAuditController(@Qualifier("sampleAuditServiceImpl") SampleAuditService sampleAuditService) {
        this.sampleAuditService = sampleAuditService;
    }

    /**
     * 服务对象
     */
    private final SampleAuditService sampleAuditService;


    /**
     * 新增数据
     *
     * @param sampleAudit 实体
     * @return 新增结果
     */
    @PostMapping
    public ResponseEntity<SampleAudit> add(SampleAudit sampleAudit) {
        return ResponseEntity.ok(this.sampleAuditService.insert(sampleAudit));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping
    public ResponseEntity<Boolean> deleteById(Integer id) {
        return ResponseEntity.ok(this.sampleAuditService.deleteById(id));
    }
}

